//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using System.Diagnostics;
using OpenLS.Core.Serialization;

namespace OpenLS.Chart
{
    public class DoughnutChart : PieChartBase
    {
        private int firstSliceAngle;

        private int holeSize = 10;

        public int FirstSliceAngle
        {
            get { return firstSliceAngle; }
            set { firstSliceAngle = value; }
        }

        public int HoleSize //\\ 10 - 90
        {
            get { return holeSize; }
            set { holeSize = value; }
        }


        protected override void VerifyAxes()
        {
            Debug.WriteLine("todo //\\" + GetType());
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("doughnutChart"))
            {
                ReadXmlBase(c);
                FirstSliceAngle = c.ReadOptionalElementIntegerAttribute("firstSliceAng", 0);
                holeSize = c.ReadOptionalElementIntegerAttribute("holeSize", 10);
                Extension = c.ReadOptionalElement<ExtensionElement>("extLst");
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("doughnutChart"))
            {
                WriteXmlBase(c);
                c.WriteOptionalElementIntegerAttribute("firstSliceAng", FirstSliceAngle, 0);
                c.WriteOptionalElementIntegerAttribute("holeSize", holeSize, 10);
                c.WriteOptionalElement(Extension);
            }
        }

        internal override IEnumerable<Axis> GetAxes()
        {
            yield break;
        }
    }
}